/*  Proteção contra CTRL-C (que gera o sinal SIGINT) */

#include <stdio.h>
#include <signal.h>


void main(void)
{
	void (*oldhandler)(int);
	printf("I can be Ctrl-C’ed\n");
	sleep(10);
	oldhandler = signal(SIGINT, SIG_IGN);
	printf("I’m protected from Ctrl-C now\n");
	sleep(10);
	signal(SIGINT, oldhandler);
	printf("I’m vulnerable again!\n");
	sleep(10);
	printf("Bye.\n");
}
